﻿@using System.Globalization
@using System.Threading
@using EveKillboard.Core.Views
@model IEnumerable<TopRegion>
@if(Model.Any()){
    <div id="topregionscontent" class="topViewlistContent">
        <div class="topRegionsLabel gradientheader">
            @if(Model.First() is TopRegionMonth){
                @string.Format(Thread.CurrentThread.CurrentCulture, EveKillboard.Content.Labels.month_top_regions, DateTime.Today.ToString("MMMM"))
            }else if (Model.First() is TopRegionWeek){
                @string.Format(Thread.CurrentThread.CurrentCulture, EveKillboard.Content.Labels.week_top_regions, 
                                     CultureInfo.InvariantCulture.Calendar.GetWeekOfYear(
                                         DateTime.UtcNow.Date,
                                         CultureInfo.InvariantCulture.DateTimeFormat.CalendarWeekRule,
                                         CultureInfo.InvariantCulture.DateTimeFormat.FirstDayOfWeek)) }</div>
        <br />
        @{ var max = (decimal)Model.First().Kills; }
        @foreach (var region in Model){
            <div class="topViewListEntry">
                <div class="topViewListEntryLabel"><a class="evelink" href="@string.Format("region/{0}", region.RegionId)">@region.Region</a></div>
                <div class="backgroundbar"><div class="innerbar" style="@string.Format(CultureInfo.InvariantCulture, "width:{0:n0}%;", (region.Kills / max) * 100)"></div></div>
                <div class="topViewListEntryCount">@region.Kills</div>
            </div>
        }
    </div>
}